home *** CD-ROM | disk | FTP | other *** search
/ PC Open 100 / PC Open 100 CD 1.bin / CD1 / INTERNET / WEBDESIGN / Tsw WebCoder / tswwebcoder5en.exe / {app} / data / tools / dialog_table.xml < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-06  |  11.5 KB  |  231 lines

  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <dialog width="490" height="490" caption="Table">
  3.     <controls>
  4.         <panel name="mainpanel" caption="" align="alclient" bevelinner="bvnone" bevelouter="bvnone">
  5.             <panel name="pnlTop" caption="" taborder="0" hint="" width="491" height="96" top="1" left="1" bevelinner="bvnone" bevelouter="bvnone">
  6.                 <edit name="edtCaption" taborder="0" text="" hint="Title for your table. Placed in the top middle." width="121" height="19" top="24" left="8"/>
  7.                 <checkbox name="cbColor" caption="Background color" taborder="1" hint="Choose a background color for your table. Is only used if you check the checkbox." checked="0" width="121" height="14" top="8" left="136"/>
  8.                 <coloredit name="cleColor" taborder="2" text="#000000" hint="" width="105" height="19" top="24" left="136"/>
  9.                 <spinedit name="speBorder" taborder="3" hint="" maxvalue="0" minvalue="0" width="49" height="20" top="72" left="8"/>
  10.                 <checkbox name="cbWidth" caption="Width" taborder="4" hint="Specify the tables width. Check if the width should be set in your code." checked="0" width="65" height="14" top="56" left="64"/>
  11.                 <spinedit name="speWidth" taborder="5" hint="" maxvalue="0" minvalue="0" width="65" height="20" top="72" left="64"/>                
  12.                 <checkbox name="cbWidthPercent" caption="%" taborder="6" hint="Decide if the value should be in percent (absolute) or in pixels (relative)." checked="1" width="25" height="17" top="74" left="132"/>
  13.                 <checkbox name="cbHeight" caption="Height" taborder="7" hint="Specify the tables height. Check if the height should be set in your code." checked="0" width="57" height="14" top="56" left="168"/>            
  14.                 <spinedit name="speHeight" taborder="8" hint="" maxvalue="0" minvalue="0" width="65" height="20" top="72" left="168"/>                
  15.                 <checkbox name="cbHeightPercent" caption="%" taborder="9" hint="Decide if the value should be in percent (absolute) or in pixels (relative)." checked="1" width="35" height="17" top="74" left="238"/>
  16.                 <spinedit name="speCellspacing" taborder="10" hint="Set the desired distance between cells." maxvalue="0" minvalue="0" value="2" width="180" height="20" top="24" left="280"/>
  17.                 <spinedit name="speCellPadding" taborder="11" hint="Set the desired distance between text and cells." maxvalue="0" minvalue="0" value="1" width="180" height="20" top="72" left="280"/>                
  18.                 <label name="lblCellPadding" caption="Distance between text and cells" hint="Set the desired distance between text and cells." width="174" height="13" top="56" left="280"/>
  19.                 <label name="lblCellSpacing" caption="Distance between cells" hint="Set the desired distance between cells." width="124" height="13" top="8" left="280"/>
  20.                 <label name="lblCaption" caption="Title" hint="Title of your table. Placed in the top middle." width="24" height="13" top="8" left="8"/>
  21.                 <label name="lblBorder" caption="Border" hint="" width="44" height="13" top="56" left="8"/>
  22.             </panel>
  23.             <panel name="pnlBottom" caption="" taborder="1" hint="" width="491" height="207" top="97" left="1" bevelinner="bvnone" bevelouter="bvnone">
  24.                 <label name="lblTableText" caption="Tabletext" hint="Type the text for the chosen cell here." width="59" height="13" top="16" left="8"/>
  25.                 <speedbutton name="btnApplyText" glyph="icons\16x16\linebreak.bmp" caption="" hint="Insert the text for the chosen cell (can also be done with Enter)." width="33" height="33" top="32" left="360">
  26.                     <event type="onclick">
  27.                         SetCellText;
  28.                     </event>
  29.                 </speedbutton>
  30.                 <label name="lblTables" caption="Tables" hint="" width="46" height="13" top="80" left="8"/>
  31.                 <label name="lblColumns" caption="Columns" hint="Choose how many columns there should be in your table." width="51" height="13" top="96" left="400"/>
  32.                 <label name="lblRows" caption="Rows" hint="Choose how many rows there should be in your table." width="45" height="13" top="146" left="400"/>
  33.                 <memo name="mmoCellText" taborder="0" hint="Type the text for the chosen cell here." width="345" height="33" top="32" left="8">
  34.                     <event type="onkeypress" callFunction="KeyPress">
  35.                         function KeyPress(Sender: TObject; var Key: Char);
  36.                            begin
  37.                           If Key = #13 then
  38.                            begin
  39.                              SetCellText;
  40.                              Key := #0;
  41.                             end; 
  42.                            Result := Key; 
  43.                          end;  
  44.                     </event>
  45.                 </memo>
  46.                 <spinedit name="speColumns" taborder="1" hint="Choose how many columns there should be in your table." maxvalue="100" minvalue="0" value="1" width="60" height="20" top="115" left="400">
  47.                     <event type="onchange">
  48.                         if speColumns.Value < 1 then exit;
  49.                         stgTableCells.ColCount := speColumns.Value;
  50.                     </event>
  51.                 </spinedit>
  52.                 <spinedit name="speRows" taborder="2" hint="Choose how many rows there should be in your table." maxvalue="100" minvalue="0" value="1" width="60" height="20" top="163" left="400">
  53.                     <event type="onchange">
  54.                         if speRows.Value < 1 then exit;
  55.                         stgTableCells.RowCount := speRows.Value;
  56.                     </event>
  57.                 </spinedit>
  58.                 <stringgrid name="stgTableCells" hint="Choose a cell, type the text above and press Enter or the Insert button." top="95" left="8" width="385" height="104" rowcount="1" colcount="1" fixedcols="0" fixedrows="0" ctl3d="0"/>
  59.             </panel>
  60.         </panel>
  61.     </controls>
  62.     <dialogfunctions>
  63.         procedure SetCellText;
  64.          begin
  65.           stgTableCells.Cells[stgTableCells.Col, stgTableCells.Row] := mmoCellText.Text;
  66.           mmoCellText.Text := '';
  67.           // Let's move to the next cell
  68.           If stgTableCells.Col < stgTableCells.ColCount - 1 then
  69.            begin
  70.             stgTableCells.Col := stgTableCells.Col+1;
  71.              end
  72.           else
  73.            If stgTableCells.Row < stgTableCells.RowCount - 1 then
  74.             begin
  75.              stgTableCells.Row := stgTableCells.Row+1;
  76.              stgTableCells.Col := 0;             
  77.             end;        
  78.          end;
  79.     </dialogfunctions>
  80.     <dialogevents>
  81.         <event type="onclose" resulttype="ok">
  82.             StartCode := ('<table');
  83.             if cbWidth.Checked then
  84.              begin
  85.               StartCode := StartCode + (' width="'+IntToStr(speWidth.Value))
  86.               if cbWidthPercent.Checked then
  87.                StartCode := StartCode + '%';
  88.               StartCode := StartCode + '"';          
  89.              end;
  90.             if cbHeight.Checked then
  91.              begin
  92.               StartCode := StartCode + (' height="'+IntToStr(speHeight.Value))
  93.               if cbHeightPercent.Checked then
  94.                StartCode := StartCode + '%';
  95.               StartCode := StartCode + '"';    
  96.             end;
  97.             if speBorder.Value > 0 then
  98.              StartCode := StartCode + (' border="'+IntToStr(speBorder.Value)+'"');
  99.             if speCellspacing.Value <> 2 then
  100.              StartCode := StartCode + (' cellspacing="'+IntToStr(speCellspacing.Value)+'"');
  101.             if speCellpadding.Value <> 1 then
  102.              StartCode := StartCode + (' cellpadding="'+IntToStr(speCellpadding.Value)+'"');
  103.             if cbColor.Checked then
  104.              StartCode := StartCode + (' bgcolor="'+(cleColor.HTMLValue)+'"');
  105.             
  106.               If edtCSSClass.Text <> '' then
  107.              StartCode := StartCode + ' class="'+edtCSSClass.Text+'"';
  108.               If edtCSSId.Text <> '' then
  109.                StartCode := StartCode + ' ID="'+edtCSSId.Text+'"';
  110.               If edtCSSStyle.Text <> '' then
  111.                StartCode := StartCode + ' style="'+edtCSSStyle.Text+'"';
  112.             for i := 0 to EventGrid.Count - 1 do
  113.               begin
  114.               if EventGrid.Rows[i].EditText <> '' then
  115.                StartCode := StartCode + ' ' + (EventGrid.Rows[i].Caption+'="' + EventGrid.Rows[i].EditText)+'"';
  116.              end;              
  117.             
  118.             StartCode := StartCode + ('>');
  119.             // Hvis vi bare redigerer tagget skal vi ikke have det her med
  120.             If cbUpdateExistingTag.Checked = false then
  121.              begin
  122.               if edtCaption.Text > '' then
  123.               StartCode := StartCode + #13#10+'<caption>'+edtCaption.Text+'</caption>';
  124.               with stgTableCells do
  125.                for I := 0 to RowCount - 1 do
  126.                 begin
  127.                  StartCode := StartCode + (#13#10+#9+'<tr>'+ #13#10);
  128.                  for J:= 0 to ColCount - 1 do
  129.                   StartCode := StartCode + (#9#9+'<td>' + cells [J,I]  + '</td>' + #13#10);
  130.                  StartCode := StartCode + (#9+'</tr>' + #13#10);
  131.                 end;
  132.              end;
  133.             If cbUpdateExistingTag.Checked then
  134.              EndCode := ''
  135.             else
  136.              EndCode := '</table>'+#13#10;
  137.               
  138.             If cbMakeXHTMLCompliant.Checked then
  139.              StartCode := MakeXHTMLCompliant(StartCode, True);            
  140.             If cbDoPHPEscape.Checked then
  141.              StartCode := DoPHPEscape(StartCode);        
  142.                   
  143.             // A little "hack" - WebCoder will set this, to let us know whether to update
  144.             // an existing tag, or insert a brand new one
  145.             If cbUpdateExistingTag.Checked then 
  146.              ReplaceTag(StartCode)
  147.             else 
  148.                InsertTags(StartCode+EndCode, '');   
  149.               
  150.         </event>
  151.         <event type="onshow">    
  152.             If cbUpdateExistingTag.Checked then
  153.              begin
  154.               pnlBottom.Visible := false;
  155.               Self.Height := Self.Height-pnlBottom.Height;
  156.              end;         
  157.             // Lets put the advanced panel in the right place
  158.             pnlAdvanced.Parent := MainPanel;
  159.             pnlAdvanced.Left := 8;
  160.             pnlAdvanced.Top := MainPanel.Height - 32;        
  161.             pnlAdvanced.Width := Self.Width - 36;
  162.             // Height of the panel will be set internally. Do we need to make the dialog higher to make room for the Advanced panel?
  163.             If pnlAdvanced.Height > 20 then
  164.              Self.Height := Self.Height + 200;
  165.  
  166.         </event>
  167.         <event type="updatedialog">
  168.             // This event will be called when a user executes the "Edit current tag"-rightclick feature
  169.             // The entire selected tag will be passed as a parameter to this function, that should update
  170.             // the required fields of the dialog.
  171.             function UpdateDialog(Tag: string);
  172.              begin            
  173.               Width := GetValueFromAttribute(Tag, 'width');
  174.               If Width[Length(Width)] = '%' then
  175.                begin
  176.                 Delete(Width, Length(Width), 1);
  177.                 cbWidthPercent.Checked := true;
  178.                end
  179.               else
  180.                cbWidthPercent.Checked := false; 
  181.               If Width <> '' then 
  182.                begin
  183.                 cbWidth.Checked := true; 
  184.                 speWidth.Value := StrtoInt(Width);
  185.                end;         
  186.                 
  187.               Height := GetValueFromAttribute(Tag, 'height');
  188.               If Height[Length(Height)] = '%' then
  189.                begin
  190.                 Delete(Height, Length(Height), 1);
  191.                 cbHeightPercent.Checked := true;
  192.                end
  193.               else
  194.                cbHeightPercent.Checked := false;                
  195.               If Height <> '' then 
  196.                begin
  197.                 cbHeight.Checked := true;
  198.                  speHeight.Value := StrtoInt(Height);                
  199.                 end; 
  200.               If GetValueFromAttribute(Tag, 'border') <> '' then 
  201.                speBorder.Value := StrToInt(GetValueFromAttribute(Tag, 'border'));
  202.               If GetValueFromAttribute(Tag, 'cellspacing') <>    '' then
  203.                speCellspacing.Value := StrToInt(GetValueFromAttribute(Tag, 'cellspacing'));
  204.               If GetValueFromAttribute(Tag, 'cellpadding') <>    '' then               
  205.                speCellpadding.Value := StrToInt(GetValueFromAttribute(Tag, 'cellpadding'));
  206.               bgColor := GetValueFromAttribute(Tag, 'bgcolor');
  207.               If bgColor <> '' then
  208.                begin
  209.                 cleColor.SelColor := ConvertColor(bgColor);
  210.                 cbColor.Checked := true;
  211.                 end;
  212.                 
  213.                lblCaption.Enabled := false;
  214.               edtCaption.Enabled := false; 
  215.          
  216.                 edtCSSClass.Text := GetValueFromAttribute(Tag, 'class');
  217.                 edtCSSId.Text := GetValueFromAttribute(Tag, 'id');
  218.                 edtCSSStyle.Text := GetValueFromAttribute(Tag, 'style');
  219.               for i := 0 to EventGrid.Count - 1 do
  220.                 begin
  221.                  EventVal := GetValueFromAttribute(Tag, Lowercase(EventGrid.Rows[i].Caption));
  222.                  If EventVal <> '' then
  223.                   EventGrid.Rows[i].EditText := EventVal;
  224.                end;               
  225.               cbDoPHPEscape.Checked := IsPHPEscaped(Tag);
  226.               cbMakeXHTMLCompliant.Checked := isXHTMLDocument();
  227.              end;
  228.         </event>
  229.     </dialogevents>
  230. </dialog>
  231.